import {jsonp} from "@/common/js/jsonp";
import {options} from "@/config/api-config/config";


export async function getHotKey () {
    const url = 'https://c.y.qq.com/splcloud/fcgi-bin/gethotkey.fcg'

    const data = {
        uin: 0,
        needNewCode: 1,
        platform: 'h5',
        g_tk: 1928093487,
        inCharset: 'utf-8',
        outCharset: 'utf-8',
        notice: 0,
        format: 'jsonp'
    }

    let ret = await jsonp(url, data, options)
    return ret.data.hotkey
}


export function searchSong_format(list) {
    return list.map(item => {
        let info = {
            musicData: {}
        }
        info.musicData.songid = item.songid
        info.musicData.songmid = item.songmid
        info.musicData.songname = item.songname
        info.musicData.albumname = item.albumname
        info.musicData.albummid = item.albummid
        info.musicData.interval = item .interval
        info.musicData.url = item.url
        info.musicData.singer = item.singer
        info.musicData.pay = item.pay
        return info
    })
}
